<?php


namespace App\service;

use Qiniu\Storage\UploadManager;
use Qiniu\Auth;

class QiniuUploade
{

    public static function uploade($name,$tmpname)
    {
        $accessKey = config('qiniu.accessKey');
        $secretKey = config('qiniu.secretKey');
        $bucket = config('qiniu.bucket');
        $uploadMgr = new UploadManager();
        $auth = new Auth($accessKey, $secretKey);
        $token = $auth->uploadToken($bucket);
        list($ret, $error) = $uploadMgr->putFile($token, $name, $tmpname);
        $arr = config('qiniu.url').$name;
        return $arr;
    }

}
